Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: invalid text 'null' in request when no args given #29

Merged
merged 4 commits into from
Oct 17, 2024

Conversation

paradox8599
Copy link
Contributor

In these requests, if the optional args are None, instead of passing a empty request body, a text 'null' will be added:
image

which results in 400 response saying

{
    "error": {
        "message": "JSON failed to parse.",
        "status_code": 400
    }
}

This fix checks for the optional args, and only write to the request body if they have values.

It is mainly for finish_file_data_upload as it allows an emty body, but the other two will still fail anyway.

in these requests, if the optional args are None, instead of passing a empty request body, a text 'null' will be added, which results in 400 response saying
```
{
    "error": {
        "message": "JSON failed to parse.",
        "status_code": 400
    }
}
```
Copy link
Collaborator

@C0D3-M4513R C0D3-M4513R left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please either reformat this pr to automatically apply these patches in generate.sh or edit the underlying specification, from which the rust crate is generated.

In these requests, if the optional args are None, instead of passing a empty request body, a text 'null' will be added, which results in 400 response saying
```
{
    "error": {
        "message": "JSON failed to parse.",
        "status_code": 400
    }
}
```

This fix checks for the optional args, and only write to the request body if they have values.

It is mainly for `finish_file_data_upload` as it allows an emty body, but the other two will still fail anyway.
@paradox8599
Copy link
Contributor Author

Please either reformat this pr to automatically apply these patches in generate.sh or edit the underlying specification, from which the rust crate is generated.

Hi! Thanks for your correction. I have tried adding it to generate.sh, but running the script result in a lot of other files being changed. Is it expected?

@Foorack
Copy link
Member

Foorack commented Oct 17, 2024 via email

@paradox8599
Copy link
Contributor Author

paradox8599 commented Oct 17, 2024

Likely, please attach everything in the PR and we can check. What kind of files?

All the changed files are already included in this PR.
I only added a new sed command to generate.sh, all other files were generated by the script.

@Foorack
Copy link
Member

Foorack commented Oct 17, 2024

Looks good to me. All the other files are just regular updates coming from newer version of the spec.

Signed-off-by: C0D3 M4513R <[email protected]>
Copy link
Collaborator

@C0D3-M4513R C0D3-M4513R left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also looks good to me now. I'll merge this later today.

@paradox8599
Copy link
Contributor Author

What should I do for future PRs? (if there's any)
Do I only include the generate.sh and edited parts?
Or simply everything generated?
Or, how do I regenerate from 1.18.5 spec as @C0D3-M4513R did?

@C0D3-M4513R
Copy link
Collaborator

C0D3-M4513R commented Oct 17, 2024

to do the regeneration, you mainly need to find the released openapi.yaml from the specification repo (https://github.com/vrchatapi/specification).

Doing that requires:

  1. find the short commit sha from the latest "release" of the specification, by going to the tags, finding the latest one and grabbing the short hash.
  2. go to the gh-pages branch, view all commits and search for the commit with that short-hash in it.
  3. view that commit (so click on the commit name, but not the hash in the name) and then click: Browse Files
  4. then click on the openapi.yaml file and click on the Raw button
  5. Copy the url
  6. in the generate.sh replace the line -i https://raw.githubusercontent.com/vrchatapi/specification/gh-pages/openapi.yaml \ with -i {the url you copied} \

@C0D3-M4513R
Copy link
Collaborator

C0D3-M4513R commented Oct 17, 2024

Do I only include the generate.sh and edited parts?

Yes, that's the ideal scenario.

@paradox8599
Copy link
Contributor Author

Sure, thank you!

@C0D3-M4513R C0D3-M4513R merged commit 7d12428 into vrchatapi:main Oct 17, 2024
3 checks passed
@paradox8599 paradox8599 deleted the finish_file_data_upload branch October 18, 2024 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants